<?php
/**
 * Created by PhpStorm.
 * User: zhang
 * Date: 14-10-30
 * Time: 上午9:14
 */
?>
<div> 请等待...</div>
<script>
    var xmlHttp;

    function createXMLHttpRequest(){
        if(window.XMLHttpRequest){
            xmlHttp = new XMLHttpRequest();
        }else if(window.ActiveXObject){
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    createXMLHttpRequest();

    function changeTime(){
        var url = "check.php?time="+new Date().getTime();
        xmlHttp.onreadystatechange = function(){
            if(xmlHttp.readyState = 4){
                var time = xmlHttp.responseText;
                document.getElementsByTagName('div')['0'].innerHTML = time;
            }
        }
        xmlHttp.open('get',url,false);
        xmlHttp.send(null);
    }
    setInterval("changeTime()",1000);
</script>